&:ltr > StBoxLayout { padding-left: $base_padding*2.5; }
&:rtl > StBoxLayout { padding-right: $base_padding*2.5; }
- .quick-toggle-label { font-weight: bold; }
+ .quick-toggle-title { font-weight: bold; }
.quick-toggle-icon, .quick-toggle-arrow { icon-size: $base_icon_size; }
}
var QuickToggle = GObject.registerClass({
Properties: {
- 'label': GObject.ParamSpec.override('label', St.Button),
+ 'title': GObject.ParamSpec.string('title', '', '',
+ GObject.ParamFlags.READWRITE,
+ null),
'icon-name': GObject.ParamSpec.override('icon-name', St.Button),
'gicon': GObject.ParamSpec.object('gicon', '', '',
GObject.ParamFlags.READWRITE,
GObject.BindingFlags.SYNC_CREATE |
GObject.BindingFlags.BIDIRECTIONAL);
- this._label = new St.Label({
- style_class: 'quick-toggle-label',
+ this._title = new St.Label({
+ style_class: 'quick-toggle-title',
y_align: Clutter.ActorAlign.CENTER,
x_align: Clutter.ActorAlign.START,
x_expand: true,
});
- this.label_actor = this._label;
- this._box.add_child(this._label);
+ this.label_actor = this._title;
+ this._box.add_child(this._title);
- this._label.clutter_text.ellipsize = Pango.EllipsizeMode.END;
+ this._title.clutter_text.ellipsize = Pango.EllipsizeMode.END;
- this.bind_property('label',
- this._label, 'text',
+ this.bind_property('title',
+ this._title, 'text',
GObject.BindingFlags.SYNC_CREATE);
}
+
+ set label(label) {
+ console.warn('Trying to set label on QuickToggle. Use title instead.');
+ this.title = label;
+ }
});
var QuickMenuToggle = GObject.registerClass({
this._systemActions = new SystemActions.getDefault();
super._init({
- label: _('Auto Rotate'),
+ title: _('Auto Rotate'),
});
this._systemActions.bind_property('can-lock-orientation',
const BluetoothToggle = GObject.registerClass(
class BluetoothToggle extends QuickToggle {
_init(client) {
- super._init({label: _('Bluetooth')});
+ super._init({title: _('Bluetooth')});
this._client = client;
class DarkModeToggle extends QuickToggle {
_init() {
super._init({
- label: _('Dark Style'),
+ title: _('Dark Style'),
iconName: 'dark-mode-symbolic',
});
this._itemBinding.bind('icon-name',
this, 'icon-name', GObject.BindingFlags.DEFAULT);
this._itemBinding.bind_full('name',
- this, 'label', GObject.BindingFlags.DEFAULT,
- (bind, source) => [true, this._transformLabel(source)],
+ this, 'title', GObject.BindingFlags.DEFAULT,
+ (bind, source) => [true, this._transformTitle(source)],
null);
this.connect('clicked', () => this.activate());
// transform function for property binding:
// Ignore the provided label if there are multiple active
// items, and replace it with something like "VPN (2)"
- _transformLabel(source) {
+ _transformTitle(source) {
const nActive = this.checked
? [...this._getActiveItems()].length
: 0;
class NightLightToggle extends QuickToggle {
_init() {
super._init({
- label: _('Night Light'),
+ title: _('Night Light'),
iconName: 'night-light-symbolic',
toggleMode: true,
});
const PROFILE_PARAMS = {
'performance': {
- label: C_('Power profile', 'Performance'),
+ title: C_('Power profile', 'Performance'),
iconName: 'power-profile-performance-symbolic',
},
'balanced': {
- label: C_('Power profile', 'Balanced'),
+ title: C_('Power profile', 'Balanced'),
iconName: 'power-profile-balanced-symbolic',
},
'power-saver': {
- label: C_('Power profile', 'Power Saver'),
+ title: C_('Power profile', 'Power Saver'),
iconName: 'power-profile-power-saver-symbolic',
},
};
.map(p => p.Profile.unpack())
.reverse();
for (const profile of profiles) {
- const {label, iconName} = PROFILE_PARAMS[profile];
- if (!label)
+ const {title, iconName} = PROFILE_PARAMS[profile];
+ if (!title)
continue;
- const item = new PopupMenu.PopupImageMenuItem(label, iconName);
+ const item = new PopupMenu.PopupImageMenuItem(title, iconName);
item.connect('activate',
() => (this._proxy.ActiveProfile = profile));
this._profileItems.set(profile, item);
class RfkillToggle extends QuickToggle {
_init() {
super._init({
- label: _('Airplane Mode'),
+ title: _('Airplane Mode'),
iconName: 'airplane-mode-symbolic',
});
});
this.set({
- label: _('%d\u2009%%').format(this._proxy.Percentage),
+ title: _('%d\u2009%%').format(this._proxy.Percentage),
fallback_icon_name: this._proxy.IconName,
gicon,
});